<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'page.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
		body{
		background-color: #eee8aa;
		
	}
	
	</style>
  <script type="text/javascript" src="./js/jquery-1.8.2.js"></script></head>
  <body >
    	<p>可点击文本框修改:
    	<div style="margin-left: 20px">
    		<c:if test="${req1=='[]'}">
    			<a href="${pageContext.request.contextPath}/Guan/GuanLiUrl_insertTextUrl.action"><button onclick="tianjia()">添加</button></a>
    		</c:if>
    		<c:if test="${req1!='[]'}">
    		<form action="" method="post">
			<c:forEach items="${req1}" var="req" varStatus="v">
				<input type="checkbox" value="${req.id}" name="ids" style="display: none;" checked="checked" >
				<input type="hidden" value="${req.id}" id="b${v.index}11"/>
				<input type="hidden" value="${req.rid}" id="b${v.index}12"/>
				<input type="hidden" value="${req.page}" id="b${v.index}13"/>
				<p>${v.index+1}.<input value="${req.text }" style="width: 500px; line-height: 20px" id="b${v.index}14">
					<button onclick="baocun(this.id)" id="b${v.index}">保存</button>
			</c:forEach> 
			</form>
			<p>
			<button onclick="shanchu(this.id)" style="margin-left: 600px;">删除所有</button>
			</c:if>   	
    	</div>
  </body>
  <script type="text/javascript">
  function shanchu(){
  	 var r=confirm("确定删除吗");
  	 if(r==true){
	  	$("form").prop("action","${pageContext.request.contextPath}/Guan/GuanLiUrl_deleteTextUrl.action");		
			$("form:first").submit();
  	}
  }
  function baocun(id){
  	var vid = $("#"+id+"11").val();
  	var rid = $("#"+id+"12").val();
  	var page = $("#"+id+"13").val();
  	var text = $("#"+id+"14").val();
  	var id0 = $("#b011").val();
  	var time =$("#time").val();
  	$.ajax({
		   type: "POST",
		   url: "${pageContext.request.contextPath}/Guan/GuanLiUrl_updateUrl.action",
		  data:{"id":id0,"u.time":time,"u.id":vid,"u.rid":rid,"u.page":page,"u.text":text},
		   dataType:"json",
		   async: false,
		   success: function(m){
		   		alert(m);
		   },
		   error:function(){
		   		alert("系统错误,请联系管理员");
		   }
		});
  }
  </script>
</html>
